package com.spring.test.instance.service;

import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.stereotype.Component;

/**
 * @author liyanhao
 * @Date 2023-03-03 11:26
 */
@Component
public class ZhangsanMergedBeanDefinitionPostProcessor
        implements MergedBeanDefinitionPostProcessor {
    @Override
    public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition,
                                                Class<?> beanType, String beanName) {
        if ("userService".equals(beanName)) {
            beanDefinition.getPropertyValues().add(
                    "orderService", new OrderService());
        }
    }
}
